import request from '@/utils/request'

// 查询串口配置列表
export function listSerialPorttConfig(query) {
  return request({
    url: '/tranShort/serialPorttConfig/list',
    method: 'get',
    params: query
  })
}


// 查询串口配置详细
export function getSerialPorttConfig(id) {
  return request({
    url: '/tranShort/serialPorttConfig/getInfo',
    method: 'get'
  })
}
// 查询所有串口
export function getSerialPortAll(id) {
  return request({
    url: '/tranShort/serialPorttConfig/getPortAll',
    method: 'get'
  })
}

// 新增串口配置
export function addSerialPorttConfig(data) {
  return request({
    url: '/tranShort/serialPorttConfig',
    method: 'post',
    data: data
  })
}

// 修改串口配置
export function updateSerialPorttConfig(data) {
  return request({
    url: '/tranShort/serialPorttConfig',
    method: 'put',
    data: data
  })
}

// 删除串口配置
export function delSerialPorttConfig(id) {
  return request({
    url: '/tranShort/serialPorttConfig/' + id,
    method: 'delete'
  })
}
// 连接串口

export function serialPortConnect(data) {
  return request({
    url: '/tranShort/serialPorttConfig/connect',
  method: 'post',
  data
  })
}

// 关闭串口
export function serialPortClose(query) {
  return request({
    url: '/tranShort/serialPorttConfig/close',
    method: 'get',
    params: query
  })
}

// 导出串口配置
export function exportSerialPorttConfig(query) {
  return request({
    url: '/tranShort/serialPorttConfig/export',
    method: 'get',
    params: query
  })
}